<?php

define('ROOT', realpath(dirname(__FILE__)), true);

error_reporting( E_ALL ); // -1
ini_set( 'display_errors', true ); // false
ini_set( 'log_errors', true );
ini_set( 'error_log', 'errors.log' );

// Engine config
include_once "engine/library/start_shared.inc";
include_once "engine/library/start_public.inc";

// Base files
include_once "library/quick.inc";

// Classes
include_class("site", "local", "ini", "log", "template",
				"page", "module", "ajaxmodule", "helper", "dbdriver", "dbase");

// Загрузка конфигурации сайта
loadBaseConfig();

// Обработчики ошибок
set_error_handler("errorsHandler");
assert_options(ASSERT_CALLBACK, 'assertHandler');


$site = new Site();

if ( ! $site->db->driver_load( $_baseConfig->get("DataBase", "driver") ) )
{
	$site->db->driver_load( "mysql_light" );
}

$site->module_search();

$site->module_autoconnect("base");

$site->module_action_fire();

$site->dispatch();